package com.cos.emp.controller;

import com.cos.emp.common.entity.Emp;
import com.cos.emp.dao.EmpMapper;
import com.cos.emp.services.EmpServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: COS
 * @time: 2022/4/28 12:21
 * @description:
 */
@RestController
@RequestMapping
public class EmpSupplierController {
    @Autowired
    private EmpServices empServices;

    @GetMapping("/getEmpByEno/{eno}")
    public Emp getEmpByEno(@PathVariable Integer eno){
        return empServices.getById(eno);
    }
    @GetMapping("/getEmpList")
    public List<Emp> getEmpList(){
        return empServices.list();
    }
    @PostMapping("/updateEmp")
    public Boolean updateEmp(@RequestBody Emp emp){
        return empServices.updateById(emp);
    }
    @PostMapping("/addEmp")
    public Boolean addEmp(@RequestBody Emp emp){
        return empServices.save(emp);
    }
    @GetMapping("/delEmp/{eno}")
    public Boolean delEmp(@PathVariable Integer eno){
        return empServices.removeById(eno);
    }
}